package practise;

import java.util.Arrays;

public class Rotate {
    public static void rotate(int[] nums, int k) {
        int len = nums.length;
        int[] ret = new int[len];
        for (int i = 0; i < len; i++) {
            ret[(i + k) % len] = nums[i];
        }
        for (int i = 0; i < len; i++) {
            nums[i] = ret[i];
        }
    }

    public static void main(String[] args) {
        rotate(new int[]{1,2,3,4,5,6,7}, 3);
    }
}
